Micron Document
🎖️GitЯра🎖️

Node / meshtastic / Meshtastic-Android / files / desktopApp / src / main / kotlin / org / meshtastic / desktop / radio / DesktopRadioTransportFactory.kt

Displaying Raw • Download

desktopApp/src/main/kotlin/org/meshtastic/desktop/radio/DesktopRadioTransportFactory.kt fix/qr-error-correction (7b45f84f) Text, 3.42 KB

T8b949e/*
* Copyright (c) 2026 Meshtastic LLC
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
Tff7b72package T7ee787org.meshtastic.desktop.radio

Tff7b72import T7ee787kotlinx.coroutines.flow.MutableStateFlow
Tff7b72import T7ee787kotlinx.coroutines.flow.StateFlow
Tff7b72import T7ee787org.meshtastic.core.ble.BleConnectionFactory
Tff7b72import T7ee787org.meshtastic.core.ble.BleScanner
Tff7b72import T7ee787org.meshtastic.core.ble.BluetoothRepository
Tff7b72import T7ee787org.meshtastic.core.di.CoroutineDispatchers
Tff7b72import T7ee787org.meshtastic.core.model.DeviceType
Tff7b72import T7ee787org.meshtastic.core.model.InterfaceId
Tff7b72import T7ee787org.meshtastic.core.network.SerialTransport
Tff7b72import T7ee787org.meshtastic.core.network.radio.BaseRadioTransportFactory
Tff7b72import T7ee787org.meshtastic.core.network.radio.TcpRadioTransport
Tff7b72import T7ee787org.meshtastic.core.repository.RadioInterfaceService
Tff7b72import T7ee787org.meshtastic.core.repository.RadioTransport
Tff7b72import T7ee787org.meshtastic.core.repository.RadioTransportFactory

T8b949e/**
* Desktop implementation of [RadioTransportFactory] delegating multiplatform transports (BLE, TCP) and providing
* platform-specific transports (USB/Serial) via jSerialComm.
*
* Registered manually in [desktopPlatformStubsModule] — do NOT add @Single to avoid double-registration with
* the @ComponentScan("org.meshtastic.desktop") in DesktopDiModule.
*/
Tff7b72class T56d364DesktopRadioTransportFactoryTb4b4b4(
Te6edf3scannerTb4b4b4: Te6edf3BleScannerTb4b4b4,
Te6edf3bluetoothRepositoryTb4b4b4: Te6edf3BluetoothRepositoryTb4b4b4,
Te6edf3connectionFactoryTb4b4b4: Te6edf3BleConnectionFactoryTb4b4b4,
Te6edf3dispatchersTb4b4b4: Te6edf3CoroutineDispatchersTb4b4b4,
Tb4b4b4) Tb4b4b4: Te6edf3BaseRadioTransportFactoryTb4b4b4(Te6edf3scannerTb4b4b4, Te6edf3bluetoothRepositoryTb4b4b4, Te6edf3connectionFactoryTb4b4b4, Te6edf3dispatchersTb4b4b4) Tb4b4b4{

Tff7b72override Tff7b72val Te6edf3supportedDeviceTypesTb4b4b4: Te6edf3ListTff7b72<Te6edf3DeviceTypeTff7b72> Tff7b72= Te6edf3listOfTb4b4b4(Te6edf3DeviceTypeTb4b4b4.Te6edf3TCPTb4b4b4, Te6edf3DeviceTypeTb4b4b4.Te6edf3BLETb4b4b4, Te6edf3DeviceTypeTb4b4b4.Te6edf3USBTb4b4b4)

T8b949e// Desktop has no unlock gesture and no demo entry in its picker; the virtual transports stay inadmissible.
Tff7b72override Tff7b72val Te6edf3mockTransportEnabledTb4b4b4: Te6edf3StateFlowTff7b72<Tffa657BooleanTff7b72> Tff7b72= Te6edf3MutableStateFlowTb4b4b4(Tff7b72falseTb4b4b4)

T8b949e/** Desktop bundles no capture asset, and [createPlatformTransport] does not wire a replay address. */
Tff7b72override Tff7b72val Te6edf3isReplayTransportAvailableTb4b4b4: Tffa657Boolean Tff7b72= Tff7b72false

Tff7b72override Tff7b72fun Td2a8ffcreatePlatformTransportTb4b4b4(Te6edf3addressTb4b4b4: Tffa657StringTb4b4b4, Te6edf3serviceTb4b4b4: Te6edf3RadioInterfaceServiceTb4b4b4)Tb4b4b4: Te6edf3RadioTransport Tff7b72= Tff7b72when Tb4b4b4{
Te6edf3addressTb4b4b4.Te6edf3startsWithTb4b4b4(Te6edf3InterfaceIdTb4b4b4.Te6edf3TCPTb4b4b4.Te6edf3idTb4b4b4) Tff7b72-Tff7b72> Tb4b4b4{
Te6edf3TcpRadioTransportTb4b4b4(
Te6edf3callback Tff7b72= Te6edf3serviceTb4b4b4,
Te6edf3scope Tff7b72= Te6edf3serviceTb4b4b4.Te6edf3serviceScopeTb4b4b4,
Te6edf3dispatchers Tff7b72= Te6edf3dispatchersTb4b4b4,
Te6edf3address Tff7b72= Te6edf3addressTb4b4b4.Te6edf3removePrefixTb4b4b4(Te6edf3InterfaceIdTb4b4b4.Te6edf3TCPTb4b4b4.Te6edf3idTb4b4b4.Te6edf3toStringTb4b4b4(Tb4b4b4)Tb4b4b4)Tb4b4b4,
Tb4b4b4)
Tb4b4b4}

Te6edf3addressTb4b4b4.Te6edf3startsWithTb4b4b4(Te6edf3InterfaceIdTb4b4b4.Te6edf3SERIALTb4b4b4.Te6edf3idTb4b4b4) Tff7b72-Tff7b72> Tb4b4b4{
Te6edf3SerialTransportTb4b4b4.Te6edf3createTb4b4b4(
Te6edf3portName Tff7b72= Te6edf3addressTb4b4b4.Te6edf3removePrefixTb4b4b4(Te6edf3InterfaceIdTb4b4b4.Te6edf3SERIALTb4b4b4.Te6edf3idTb4b4b4.Te6edf3toStringTb4b4b4(Tb4b4b4)Tb4b4b4)Tb4b4b4,
Te6edf3callback Tff7b72= Te6edf3serviceTb4b4b4,
Te6edf3scope Tff7b72= Te6edf3serviceTb4b4b4.Te6edf3serviceScopeTb4b4b4,
Te6edf3dispatchers Tff7b72= Te6edf3dispatchersTb4b4b4,
Tb4b4b4)
Tb4b4b4}

Tff7b72else Tff7b72-Tff7b72> Te6edf3errorTb4b4b4(Ta5d6ff"Ta5d6ffUnsupported transport for address: Tffd700$Te6edf3addressTa5d6ff"Tb4b4b4)
Tb4b4b4}
Tb4b4b4}

Served by rngit 1.5.0 - Generated in 0.04s